package com.longjianghuasheng.logistics.network

import com.longjianghuasheng.logistics.business.detail.WarehousingEntity
import com.longjianghuasheng.logistics.business.home.NewsResponse
import com.longjianghuasheng.logistics.business.home.TypeResponse
import com.longjianghuasheng.logistics.data.model.bean.ApiResponse
import com.longjianghuasheng.logistics.data.model.bean.ApiResponseNoData
import com.longjianghuasheng.logistics.entity.*
import okhttp3.MultipartBody
import retrofit2.http.*
import java.lang.Deprecated

/**
 * 作者　: hegaojian
 * 时间　: 2019/12/23
 * 描述　: 网络API
 */
interface ApiService {


    //短信验证码
    @FormUrlEncoded
    @POST("api/get_code")
    suspend fun get_code(
        @Field("mobile") mobile: String,
        @Field("type") type: Int//1注册、修改手机号 2其它
    ): ApiResponse<Any?>

    //注册
    @FormUrlEncoded
    @POST("api/register")
    suspend fun register(
        @Field("mobile") mobile: String,
        @Field("password") password: String,
        @Field("repassword") repassword: String,
        @Field("code") code: String,
        @Field("type") type: Int,
    ): LoginResponse

    //忘记密码
    @FormUrlEncoded
    @POST("api/password_reset")
    suspend fun password_reset(
        @Field("mobile") mobile: String,
        @Field("password") password: String,
        @Field("repassword") repassword: String,
        @Field("code") code: String,
    ): ApiResponseNoData


    //短信登录
    @FormUrlEncoded
    @POST("api/login_code")
    suspend fun login_code(
        @Field("mobile") mobile: String,
        @Field("code") code: String
    ): LoginResponse

    //密码登录
    @FormUrlEncoded
    @POST("api/login")
    suspend fun login(
        @Field("mobile") mobile: String,
        @Field("password") password: String
    ): LoginResponse

    //个人中心信息
    @POST("api/my_info")
    suspend fun my_info(): ApiResponse<MyInfoResponse>

    //地址列表
    @POST("api/address_list2")
    suspend fun address_list(): ApiResponse<ArrayList<AddressResponse>>

    //新增、修改地址薄
    @FormUrlEncoded
    @POST("api/address_save")
    suspend fun address_save(
        @FieldMap map: Map<String, String>
    ): ApiResponseNoData

    //删除地址
    @FormUrlEncoded
    @POST("api/address_del")
    suspend fun address_del(
        @Field("id") id: Int
    ): ApiResponseNoData

    //地区三级联动
    @FormUrlEncoded
    @POST("api/area")
    suspend fun area(@Field("pid") pid: Int): ApiResponse<AreaResponse>

    //地址回显
    @FormUrlEncoded
    @POST("api/address_show")
    suspend fun address_show(@Field("id") id: Int): ApiResponse<AddressResponse>

    //设置默认地址
    @FormUrlEncoded
    @POST("api/address_default")
    suspend fun address_default(@Field("id") id: Int): ApiResponseNoData

    //抢单大厅列表--
    @FormUrlEncoded
    @POST("api/driver_form_list")
    suspend fun driver_form_list(@Field("page") page: Int): ApiResponse<DriverFormListResponse>

    //客服电话
    @POST("api/hot_line")
    suspend fun hot_line(): ApiResponse<String>

    //banner接口--
    @FormUrlEncoded
    @POST("api/banner")//type 1启动页 2移动端首页 3pc首页 4车队招募 5司机招募
    suspend fun banner(@Field("type") type: Int): ApiResponse<ArrayList<String>>   //banner接口--

    //新闻列表
    @FormUrlEncoded
    @POST("api/news_list")
    suspend fun news_list(@Field("page") page: Int): NewsResponse

    //服务分类
    @FormUrlEncoded
    @POST("api/service_type")
    suspend fun service_type(@Field("pid") pid: Int): ApiResponse<ArrayList<TypeResponse>>

    //服务列表-无分页
    @FormUrlEncoded
    @POST("api/service_list2")
    suspend fun service_list2(@Field("type") type: Int): ApiResponse<ArrayList<FreightResponse>>

    //完善个人信息-企业
    @Deprecated
    @FormUrlEncoded
    @POST("api/company_info")
    suspend fun company_info(
        @Field("real_name") real_name: String,
        @Field("address") address: String,
        @Field("contact") contact: String,
        @Field("tel") tel: String,
        @Field("code") code: String,
        @Field("card_front") card_front: String,
    ): ApiResponseNoData

    //完善个人信息-个人
//    @FormUrlEncoded
//    @POST("api/person_info")
//    suspend fun person_info(
//        @Field("real_name") real_name: String,
//        @Field("sex") sex: Int,
//        @Field("tel") tel: String,
//        @Field("card_no") card_no: String,
//        @Field("card_front") card_front: String,
//        @Field("card_back") card_back: String,
//    ): ApiResponseNoData

    /**
     * 上传图片
     */
    @Multipart
    @POST("api/img_upload")
    suspend fun img_upload(@Part part: MultipartBody.Part): ApiResponse<PictureUrl>

    /**
     * 上传签约文件接口
     */
    @FormUrlEncoded
    @POST("api/sign_files")
    suspend fun sign_files(
        @Field("signs[]") signs: Array<String>,
        @Field("id") id: Int,
    ): ApiResponseNoData


    //订单列表
    @FormUrlEncoded
    @POST("api/order_list")
    suspend fun order_list(
        @Field("page") page: Int,
        @Field("type") type: Int,
        @Field("status") status: Int,
        @Field("keywords") keywords: String,
    ): OrderList


    //订单分类
    @POST("api/service_order_type")
    suspend fun service_order_type(
    ): ApiResponse<ArrayList<OrderType>>

    //订单详情
    @FormUrlEncoded
    @POST("api/order_show")
    suspend fun order_show(
        @Field("id") id: Int,
    ): OrderDetailResponse

    //订单取消、删除
    @FormUrlEncoded
    @POST("api/order_del")
    suspend fun order_del(
        @Field("id") id: Int,
    ): ApiResponseNoData

    //签约页面信息
    @FormUrlEncoded
    @POST("api/sign_info")
    suspend fun sign_info(
        @Field("id") id: Int,
    ): ApiResponse<SignInfo>

    //账期金额
    @POST("api/account_data")
    suspend fun account_data(
    ): AccountResponse

    //钱包
    @POST("api/my_wallet")
    suspend fun my_wallet(
    ): WalletResponse

    //提现接口
    @FormUrlEncoded
    @POST("api/my_withdraw")
    suspend fun my_withdraw(
        @Field("price") price: String,
        @Field("type") type: Int,
        @Field("type_name") type_name: String
    ): ApiResponseNoData

    //申请账期
    @POST("api/account")
    suspend fun account(
    ): ApiResponseNoData

    //申请账期
    @FormUrlEncoded
    @POST("api/avatar")
    suspend fun avatar(
        @Field("avatar") avatar: String,
    ): ApiResponseNoData

    //车队合作表单
    @FormUrlEncoded
    @POST("api/team_work")
    suspend fun team_work(
        @Field("names") names: String,
        @Field("address") address: String,
        @Field("contact") contact: String,
        @Field("mobile") mobile: String,
        @Field("code") code: String,
        @Field("card_front") card_front: String,
        @Field("card_back") card_back: String,
        @Field("books") books: String,
    ): ApiResponseNoData


    //发布记录列表
    @FormUrlEncoded
    @POST("api/pre_order_list")
    suspend fun pre_order_list(
        @Field("page") page: Int,
        @Field("status") status: Int,
        @Field("keywords") keywords: String,
    ): ReleaseListResponse


    //发布记录-删除
    @FormUrlEncoded
    @POST("api/pre_del")
    suspend fun pre_del(
        @Field("id") id: Int,
    ): ApiResponseNoData

    //发布记录详情（用户发布）
    @FormUrlEncoded
    @POST("api/pre_order_show")
    suspend fun pre_order_show(
        @Field("id") id: Int,
    ): RecordDetailResponse

    //发布记录-同意
    @FormUrlEncoded
    @POST("api/agree")
    suspend fun agree(
        @Field("id") id: Int,
    ): ApiResponseNoData

    //意见反馈
    @FormUrlEncoded
    @POST("api/feedback")
    suspend fun feedback(
        @Field("type") type: Int,
        @Field("content") content: String,
        @Field("picarr[]") picarr: Array<String>,
    ): ApiResponseNoData

    //修改手机号
    @FormUrlEncoded
    @POST("api/change_mobile")
    suspend fun change_mobile(
        @Field("mobile") mobile: String,
        @Field("code") code: String,
    ): ApiResponseNoData

    //修改密码
    @FormUrlEncoded
    @POST("api/change_password")
    suspend fun change_password(
        @Field("old_password") old_password: String,
        @Field("password") password: String,
        @Field("repassword") repassword: String,
    ): ApiResponseNoData

    //司机合作表单
    @FormUrlEncoded
    @POST("api/driver_work")
    suspend fun driver_work(
        @Field("names") names: String,
        @Field("mobile") mobile: String,
        @Field("code") code: String,
        @Field("card_front") card_front: String,
        @Field("card_back") card_back: String,
        @Field("books") books: String,
        @FieldMap map: Map<String, String>,
        @Field("team_id") team_id: Int,
    ): ApiResponseNoData

    //个人合作表单
    @FormUrlEncoded
    @POST("api/people_work")
    suspend fun people_work(
        @Field("names") names: String,
        @Field("sex") sex: Int,
        @Field("mobile") mobile: String,
        @Field("card_front") card_front: String,
        @Field("card_back") card_back: String,
        @Field("card_no") card_no: String,
    ): ApiResponseNoData

    //企业合作表单
    @FormUrlEncoded
    @POST("api/company_work")
    suspend fun company_work(
        @Field("names") names: String,
        @Field("address") address: String,
        @Field("contact") contact: String,
        @Field("mobile") mobile: String,
        @Field("code") code: String,
        @Field("card_front") card_front: String,
        @Field("card_back") card_back: String,
        @Field("books") books: String,
    ): ApiResponseNoData

    //单页
    @FormUrlEncoded
    @POST("api/abouts")
    suspend fun abouts(
        @Field("id") id: Int,
    ): ApiResponse<AboutResponse>


    //提交表单
    @FormUrlEncoded
    @POST("api/service_form")
    suspend fun service_form(
        @FieldMap map: Map<String, String>
    ): ApiResponseNoData


    //园区仓储表单页面信息
    @FormUrlEncoded
    @POST("api/storage_info")
    suspend fun storage_info(
        @Field("id") id: Int,
    ): StorageInfoResponse

    //其它表单页面信息
    @FormUrlEncoded
    @POST("api/form_info")
    suspend fun form_info(
        @Field("id") id: Int,
    ): StorageInfoResponse

    //库位列表
    @FormUrlEncoded
    @POST("api/storage_son")
    suspend fun storage_son(
        @Field("pid") pid: Int,
    ): ApiResponse<ArrayList<WarehousingEntity>>

    //司机抢单
    @FormUrlEncoded
    @POST("api/driver_do")
    suspend fun driver_do(
        @Field("pid") pid: Int,
    ): ApiResponseNoData

    //司机接单列表
    @FormUrlEncoded
    @POST("api/driver_order_list")
    suspend fun driver_order_list(
        @Field("page") page: Int,
        @Field("status") status: Int,
    ): OrderList

    //司机接单详情
    @FormUrlEncoded
    @POST("api/driver_order_show")
    suspend fun driver_order_show(
        @Field("id") id: Int,
    ): ApiResponse<Order>

    //订单取消申请
    @FormUrlEncoded
    @POST("api/driver_order_cancel")
    suspend fun driver_order_cancel(
        @Field("id") id: Int,
    ): ApiResponseNoData

    //司机订单删除申请
    @FormUrlEncoded
    @POST("api/driver_order_del")
    suspend fun driver_order_del(
        @Field("id") id: Int,
    ): ApiResponseNoData

    //司机订单完成申请
    @FormUrlEncoded
    @POST("api/driver_order_done")
    suspend fun driver_order_done(
        @Field("id") id: Int,
    ): ApiResponseNoData

    //用户订单完成申请
    @FormUrlEncoded
    @POST("api/order_done")
    suspend fun order_done(
        @Field("id") id: Int,
    ): ApiResponseNoData

    //帮助中心列表
    @POST("api/help_list")
    suspend fun help_list(): HelpList

    //帮助中心列表
    @FormUrlEncoded
    @POST("api/help_show")
    suspend fun help_show(
        @Field("id") id: Int,
    ): ApiResponse<AboutResponse>

    //过审车队列表（司机合作表单选择车队时使用）
    @POST("api/team_work_list")
    suspend fun team_work_list(
    ): ApiResponse<ArrayList<Company>>

    //新闻详情
    @FormUrlEncoded
    @POST("api/news_show")
    suspend fun news_show(
        @Field("id") id: Int,
    ): ApiResponse<AboutResponse>

    //仓储平面展示图
    @POST("api/storage_pic")
    suspend fun storage_pic(
    ): StoragePicResponse


    //抢单详情
    @FormUrlEncoded
    @POST("api/driver_form_show")
    suspend fun driver_form_show(
        @Field("id") id: Int,
    ): ApiResponse<DriverFormListItem>

    //获取参考价格
    @FormUrlEncoded
    @POST("service/ref_price")
    suspend fun ref_price(
        @Field("juli") juli: String,
        @Field("yunshu") yunshu: String,
        @Field("weight") weight: String,
    ): ApiResponse<Int>

    //订单追加服务
    @FormUrlEncoded
    @POST("api/order_zjfw")
    suspend fun order_zjfw(
        @Field("id") id: Int,
        @Field("con") con: String,
    ): ApiResponseNoData


}